[geo-layers] Fix TerrainLayer globe Mercator tile warping#10293
Open
charlieforward9 wants to merge 2 commits into
Open
[geo-layers] Fix TerrainLayer globe Mercator tile warping#10293charlieforward9 wants to merge 2 commits into
charlieforward9 wants to merge 2 commits into
Conversation
065f81f to
7a58fd4
Compare
7a58fd4 to
6bf36a5
Compare
4 tasks
charlieforward9
commented
May 13, 2026
| meshMaxError, | ||
| signal | ||
| })?.then(mesh => | ||
| viewport.resolution && mesh ? remapMeshToWebMercatorTile(mesh, overlappedBounds) : mesh |
Collaborator
Author
There was a problem hiding this comment.
Unsure how much this costs - seems heavy.
Easier to handle directly in loadTerrain? Gotta check
| }; | ||
| } | ||
|
|
||
| function lngLatToMercatorY(latitude: number): number { |
| const isTileSetURL = (url: string): boolean => | ||
| url.includes('{x}') && (url.includes('{y}') || url.includes('{-y}')); | ||
|
|
||
| function remapMeshToWebMercatorTile(mesh: Mesh, bounds: Bounds): Mesh { |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes GlobeView terrain and bitmap tile warping for WebMercator tiles by remapping tile rows through inverse WebMercator instead of treating rows as linearly spaced latitude.
Why
WebMercator tiles do not encode latitude linearly from top to bottom. On GlobeView, using linear latitude for mesh rows compresses terrain and imagery near the poles and becomes very visible at far zooms.
Change
TerrainLayerglobe mesh generation to remap row latitude from WebMercator tile coordinates.Validation
test/modules/geo-layers/terrain-layer.spec.tsandtest/modules/geo-layers/tile-layer/tile-layer.spec.ts.Visual
Before, terrain is visibly warped:
https://github.com/user-attachments/assets/2154f023-8df4-422c-a2f3-fd05006d0be4
Merge Notes
Stacked on #10250 / base branch
cr/feat/terrain-layer-globe-grid. Merge after its base terrain-grid work is accepted.